
const toast = ({title='加载中...',icon='none',duration=2000,mask=true} = {})=>{
  wx.showToast({
    title,
    icon,
    duration,
    mask
  })
}

const modal = (options = {})=>{
  const defaultOptions = {
    title:'提示',
    content:'您确定执行该操作？',
    confirmColor:'#f3514f'
  }
  const opts = Object.assign({},defaultOptions,options)
  return new Promise((resolve)=>{

    wx.showModal({
      ...opts,
      complete ({confirm,cancel}) {
       confirm&&resolve(true)
        cancel&&resolve(false)
      }
    })

  })
}










wx.toast = toast 
wx.modal = modal 

export  {
  toast
}